/*
 * 文件名：LoginController.java
 * 版权：MoonBox 
 * 修改人：Peter
 * 修改时间：2018年9月28日
 * 修改内容：新增
 */
package com.renzhebiao.lkang.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.renzhebiao.lkang.comment.Need;
import com.renzhebiao.lkang.dto.LoginDTO;
import com.renzhebiao.lkang.facade.LoginFacade;
import com.renzhebiao.lkang.master.ExecuteResult;
import com.renzhebiao.lkang.po.LoginVO;

import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 
 * @author Peter
 * @since 1.0.0
 */
@RestController
public class LoginController {

    @Autowired
    private LoginFacade loginFacade;

    @ApiOperation(value = "用户登陆", notes = "用户登陆", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping("/logi")
    public ExecuteResult<LoginVO> login(@RequestBody LoginDTO login) {
        // System.out.println("hello lkang");

        return ExecuteResult.ok(this.loginFacade.login(login));
    }

    @ApiOperation(value = "退出登录", notes = "用户登录", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping("/logout")
    @Need(token = true)
    public ExecuteResult<?> logout() {
        return ExecuteResult.ok();
    }

}
